package com.xbongbong.paas.feign;

import com.xbongbong.paas.pojo.ValidateReturnPoJo;
import com.xbongbong.paas.pojo.dto.FormDataUpdateDTO;
import com.xbongbong.paas.pojo.dto.ValidateDataDTO;
import com.xbongbong.paas.pojo.vo.FormDataUpdateVO;
import com.xbongbong.paas.pojo.workflow.execute.dto.WorkflowUpdateFlowStatusDTO;
import com.xbongbong.paas.pojo.workflow.task.dto.WorkflowNodeTaskGetDTO;
import com.xbongbong.paas.pojo.workflow.task.vo.WorkflowNodeTaskGetVO;
import com.xbongbong.paas.toolbox.wrap.BaseVO;
import com.xbongbong.paas.toolbox.wrap.XbbResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author 吴峰
 * @date 2022/11/10 16:44
 */
@FeignClient(name = "xbb-work-order-web", contextId = "workOrderV2WorkflowFeignClient")
public interface WorkOrderV2WorkflowFeignClient {

    /**
     * 审批更新数据
     * @param formDataUpdateDTO
     * @param lang 国际化 i18n 参数
     * @return
     * @throws
     * @author 吴峰
     * @date 2022/11/10 16:54
     * @throws
     */
    @RequestMapping(value = "/pro/v1/workOrderV2/workflow/update", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    XbbResponse<FormDataUpdateVO> update(@RequestBody FormDataUpdateDTO formDataUpdateDTO, @RequestParam("lang") String lang);

    /**
     * 业务层解析
     * @param validateDataDTO
     * @param lang
     * @return
     */
    @RequestMapping(value = "/pro/v1/workOrderV2/workflow/validateData", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    XbbResponse<ValidateReturnPoJo> analytical(@RequestBody ValidateDataDTO validateDataDTO, @RequestParam("lang") String lang);

    /**
     * 更新工单的审批状态
     * @param workflowUpdateFlowStatusDTO
     * @param lang
     * @return
     */
    @RequestMapping(value = "/pro/v1/workOrderV2/workflow/updateFlowStatus", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    XbbResponse<BaseVO> updateFlowStatus(@RequestBody WorkflowUpdateFlowStatusDTO workflowUpdateFlowStatusDTO, @RequestParam("lang") String lang);

    @RequestMapping(value = "/pro/v1/workOrderV2/workflow/detail", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    XbbResponse<WorkflowNodeTaskGetVO> detail(@RequestBody WorkflowNodeTaskGetDTO workflowNodeTaskGetDTO, @RequestParam("lang") String lang);
}
